<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <meta charset="utf-8" />
    <title>login</title>
    <!-- Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
    <!-- 在bootstrap.min.js 之前引入 -->
    <link href="//cdn.bootcss.com/tether/1.3.6/css/tether.min.css" rel="stylesheet">
    <script src="//cdn.bootcss.com/tether/1.3.6/js/tether.min.js"></script>

    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <!-- Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
    <script type="text/css">
        .form-horizontal{
            float: none;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

    </script>
    <script>
         function validate() {
             var ifSub;
             if($("#username").val()==''|| $("#password").val()==''){
                 alert("用户名或密码不能为空！")
                 ifSub = false;
             }else{
                 ifSub=true;
             }
             if(ifSub){
                 ;
             }
         }
         function ajaxLogin() {
             $.ajax({
                 data:{username:$("#username").val(),password:$("#password").val()},
                 type:"POST",
                 dataType: 'JSON',
                 url:"/webssm/login",
                 success:function (data) {
                     if (data.code == '0') {
                          window.location.href = "/WEB-INF/jsp/login.jsp";
                          alert("欢迎！");
                      }else{
                         alert("error！");
                     }
                 },
             });
         }
    </script>
    <style type="text/css">
        .col-center-block {
            float: none;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }
        .col-centered {
            display:inline-block;
            float:none;
            text-align:left;
            margin-right:-4px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-4 column">
        </div>
        <div class="col-md-4 column col-center-block col-centered">

            <form  action="login" method="post" class="form-horizontal" role="form" onsubmit="true">
                <div class="form-group">
                    <label for="username" class="col-sm-2 control-label">用&nbsp;户&nbsp;名</label>
                    <div class="col-sm-10">
                        <input class="form-control" name="username" id="username" type="text" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="password" class="col-sm-2 control-label">密&nbsp;&nbsp;码</label>
                    <div class="col-sm-10">
                        <input class="form-control" name="password" id="password" type="password" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <div class="checkbox">
                            <label><input type="checkbox" id="checkbox"/>记住密码</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default"  >登录</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-md-4 column">
        </div>
    </div>
</div>
</body>
</html>